# frozen_string_literal: true
# encoding: utf-8

# Options:
=begin
Date: 2025-11-03 11:38:36
Version: 8.91
Tip: To override a DTO option, remove "//" prefix before updating
BaseUrl: https://localhost:5001

#MakePartial: True
#MakeVirtual: True
#MakeInternal: False
#MakeDataContractsExtensible: False
#AddReturnMarker: True
#AddDescriptionAsComments: True
#AddDataContractAttributes: False
#AddIndexesToDataMembers: False
#AddGeneratedCodeAttributes: False
#AddResponseStatus: False
#AddImplicitVersion: 
#InitializeCollections: False
#ExportValueTypes: False
IncludeTypes: ChatCompletion.*
#ExcludeTypes: 
#AddNamespaces: 
#AddDefaultXmlNamespace: http://schemas.servicestack.net/types
=end

require 'json'


module ResponseFormat
    TEXT = 'Text'
    JSON_OBJECT = 'JsonObject'
end

module ToolType
    FUNCTION = 'Function'
end

module IPost
    pass
end

# @DataContract
class AiContent
    # @DataMember(Name="type")
    # @return [String]
    attr_accessor :type
end

#
# The tool calls generated by the model, such as function calls.
#
# @DataContract
class ToolCall
    # @DataMember(Name="id")
    # @return [String]
    attr_accessor :id

    # @DataMember(Name="type")
    # @return [String]
    attr_accessor :type

    # @DataMember(Name="function")
    # @return [String]
    attr_accessor :function
end

#
# A list of messages comprising the conversation so far.
#
# @DataContract
class AiMessage
    # @DataMember(Name="content")
    # @return [List]
    attr_accessor :content

    # @DataMember(Name="role")
    # @return [String]
    attr_accessor :role

    # @DataMember(Name="name")
    # @return [String]
    attr_accessor :name

    # @DataMember(Name="tool_calls")
    # @return [List]
    attr_accessor :tool_calls

    # @DataMember(Name="tool_call_id")
    # @return [String]
    attr_accessor :tool_call_id
end

#
# Parameters for audio output. Required when audio output is requested with modalities: [audio]
#
# @DataContract
class AiChatAudio
    # @DataMember(Name="format")
    # @return [String]
    attr_accessor :format

    # @DataMember(Name="voice")
    # @return [String]
    attr_accessor :voice
end

# @DataContract
class AiResponseFormat
    # @DataMember(Name="response_format")
    # @return [ResponseFormat]
    attr_accessor :type
end

# @DataContract
class Tool
    # @DataMember(Name="type")
    # @return [ToolType]
    attr_accessor :type
end

# @DataContract
class ResponseError
    # @DataMember(Order=1)
    # @return [String]
    attr_accessor :error_code

    # @DataMember(Order=2)
    # @return [String]
    attr_accessor :field_name

    # @DataMember(Order=3)
    # @return [String]
    attr_accessor :message

    # @DataMember(Order=4)
    # @return [Dictionary]
    attr_accessor :meta
end

# @DataContract
class ResponseStatus
    # @DataMember(Order=1)
    # @return [String]
    attr_accessor :error_code

    # @DataMember(Order=2)
    # @return [String]
    attr_accessor :message

    # @DataMember(Order=3)
    # @return [String]
    attr_accessor :stack_trace

    # @DataMember(Order=4)
    # @return [List]
    attr_accessor :errors

    # @DataMember(Order=5)
    # @return [Dictionary]
    attr_accessor :meta
end

#
# Annotations for the message, when applicable, as when using the web search tool.
#
# @DataContract
class UrlCitation
    # @DataMember(Name="end_index")
    # @return [Integer]
    attr_accessor :end_index

    # @DataMember(Name="start_index")
    # @return [Integer]
    attr_accessor :start_index

    # @DataMember(Name="title")
    # @return [String]
    attr_accessor :title

    # @DataMember(Name="url")
    # @return [String]
    attr_accessor :url
end

#
# Annotations for the message, when applicable, as when using the web search tool.
#
# @DataContract
class ChoiceAnnotation
    # @DataMember(Name="type")
    # @return [String]
    attr_accessor :type

    # @DataMember(Name="url_citation")
    # @return [UrlCitation]
    attr_accessor :url_citation
end

#
# If the audio output modality is requested, this object contains data about the audio response from the model.
#
# @DataContract
class ChoiceAudio
    # @DataMember(Name="data")
    # @return [String]
    attr_accessor :data

    # @DataMember(Name="expires_at")
    # @return [Integer]
    attr_accessor :expires_at

    # @DataMember(Name="id")
    # @return [String]
    attr_accessor :id

    # @DataMember(Name="transcript")
    # @return [String]
    attr_accessor :transcript
end

# @DataContract
class ChoiceMessage
    # @DataMember(Name="content")
    # @return [String]
    attr_accessor :content

    # @DataMember(Name="refusal")
    # @return [String]
    attr_accessor :refusal

    # @DataMember(Name="reasoning")
    # @return [String]
    attr_accessor :reasoning

    # @DataMember(Name="role")
    # @return [String]
    attr_accessor :role

    # @DataMember(Name="annotations")
    # @return [List]
    attr_accessor :annotations

    # @DataMember(Name="audio")
    # @return [ChoiceAudio]
    attr_accessor :audio

    # @DataMember(Name="tool_calls")
    # @return [List]
    attr_accessor :tool_calls
end

# @DataContract
class Choice
    # @DataMember(Name="finish_reason")
    # @return [String]
    attr_accessor :finish_reason

    # @DataMember(Name="index")
    # @return [Integer]
    attr_accessor :index

    # @DataMember(Name="message")
    # @return [ChoiceMessage]
    attr_accessor :message
end

#
# Usage statistics for the completion request.
#
# @DataContract
class AiCompletionUsage
    # @DataMember(Name="accepted_prediction_tokens")
    # @return [Integer]
    attr_accessor :accepted_prediction_tokens

    # @DataMember(Name="audio_tokens")
    # @return [Integer]
    attr_accessor :audio_tokens

    # @DataMember(Name="reasoning_tokens")
    # @return [Integer]
    attr_accessor :reasoning_tokens

    # @DataMember(Name="rejected_prediction_tokens")
    # @return [Integer]
    attr_accessor :rejected_prediction_tokens
end

#
# Breakdown of tokens used in the prompt.
#
# @DataContract
class AiPromptUsage
    # @DataMember(Name="accepted_prediction_tokens")
    # @return [Integer]
    attr_accessor :accepted_prediction_tokens

    # @DataMember(Name="audio_tokens")
    # @return [Integer]
    attr_accessor :audio_tokens

    # @DataMember(Name="cached_tokens")
    # @return [Integer]
    attr_accessor :cached_tokens
end

#
# Usage statistics for the completion request.
#
# @DataContract
class AiUsage
    # @DataMember(Name="completion_tokens")
    # @return [Integer]
    attr_accessor :completion_tokens

    # @DataMember(Name="prompt_tokens")
    # @return [Integer]
    attr_accessor :prompt_tokens

    # @DataMember(Name="total_tokens")
    # @return [Integer]
    attr_accessor :total_tokens

    # @DataMember(Name="completion_tokens_details")
    # @return [AiCompletionUsage]
    attr_accessor :completion_tokens_details

    # @DataMember(Name="prompt_tokens_details")
    # @return [AiPromptUsage]
    attr_accessor :prompt_tokens_details
end

#
# Text content part
#
# @DataContract
class AiTextContent < AiContent
    # @DataMember(Name="text")
    # @return [String]
    attr_accessor :text
end

# @DataContract
class AiImageUrl
    # @DataMember(Name="url")
    # @return [String]
    attr_accessor :url
end

#
# Image content part
#
# @DataContract
class AiImageContent < AiContent
    # @DataMember(Name="image_url")
    # @return [AiImageUrl]
    attr_accessor :image_url
end

#
# Audio content part
#
# @DataContract
class AiInputAudio
    # @DataMember(Name="data")
    # @return [String]
    attr_accessor :data

    # @DataMember(Name="format")
    # @return [String]
    attr_accessor :format
end

#
# Audio content part
#
# @DataContract
class AiAudioContent < AiContent
    # @DataMember(Name="input_audio")
    # @return [AiInputAudio]
    attr_accessor :input_audio
end

#
# File content part
#
# @DataContract
class AiFile
    # @DataMember(Name="file_data")
    # @return [String]
    attr_accessor :file_data

    # @DataMember(Name="filename")
    # @return [String]
    attr_accessor :filename

    # @DataMember(Name="file_id")
    # @return [String]
    attr_accessor :file_id
end

#
# File content part
#
# @DataContract
class AiFileContent < AiContent
    # @DataMember(Name="file")
    # @return [AiFile]
    attr_accessor :file
end

# @DataContract
class ChatResponse
    # @DataMember(Name="id")
    # @return [String]
    attr_accessor :id

    # @DataMember(Name="choices")
    # @return [List]
    attr_accessor :choices

    # @DataMember(Name="created")
    # @return [Integer]
    attr_accessor :created

    # @DataMember(Name="model")
    # @return [String]
    attr_accessor :model

    # @DataMember(Name="system_fingerprint")
    # @return [String]
    attr_accessor :system_fingerprint

    # @DataMember(Name="object")
    # @return [String]
    attr_accessor :object

    # @DataMember(Name="service_tier")
    # @return [String]
    attr_accessor :service_tier

    # @DataMember(Name="usage")
    # @return [AiUsage]
    attr_accessor :usage

    # @DataMember(Name="metadata")
    # @return [Dictionary]
    attr_accessor :metadata

    # @DataMember(Name="responseStatus")
    # @return [ResponseStatus]
    attr_accessor :response_status
end

#
# Chat Completions API (OpenAI-Compatible)
#
# @Route("/v1/chat/completions", "POST")
# @DataContract
class ChatCompletion
    # @DataMember(Name="messages")
    # @return [List]
    attr_accessor :messages

    # @DataMember(Name="model")
    # @return [String]
    attr_accessor :model

    # @DataMember(Name="audio")
    # @return [AiChatAudio]
    attr_accessor :audio

    # @DataMember(Name="logit_bias")
    # @return [Dictionary]
    attr_accessor :logit_bias

    # @DataMember(Name="metadata")
    # @return [Dictionary]
    attr_accessor :metadata

    # @DataMember(Name="reasoning_effort")
    # @return [String]
    attr_accessor :reasoning_effort

    # @DataMember(Name="response_format")
    # @return [AiResponseFormat]
    attr_accessor :response_format

    # @DataMember(Name="service_tier")
    # @return [String]
    attr_accessor :service_tier

    # @DataMember(Name="safety_identifier")
    # @return [String]
    attr_accessor :safety_identifier

    # @DataMember(Name="stop")
    # @return [List]
    attr_accessor :stop

    # @DataMember(Name="modalities")
    # @return [List]
    attr_accessor :modalities

    # @DataMember(Name="prompt_cache_key")
    # @return [String]
    attr_accessor :prompt_cache_key

    # @DataMember(Name="tools")
    # @return [List]
    attr_accessor :tools

    # @DataMember(Name="verbosity")
    # @return [String]
    attr_accessor :verbosity

    # @DataMember(Name="temperature")
    # @return [Float]
    attr_accessor :temperature

    # @DataMember(Name="max_completion_tokens")
    # @return [Integer]
    attr_accessor :max_completion_tokens

    # @DataMember(Name="top_logprobs")
    # @return [Integer]
    attr_accessor :top_logprobs

    # @DataMember(Name="top_p")
    # @return [Float]
    attr_accessor :top_p

    # @DataMember(Name="frequency_penalty")
    # @return [Float]
    attr_accessor :frequency_penalty

    # @DataMember(Name="presence_penalty")
    # @return [Float]
    attr_accessor :presence_penalty

    # @DataMember(Name="seed")
    # @return [Integer]
    attr_accessor :seed

    # @DataMember(Name="n")
    # @return [Integer]
    attr_accessor :n

    # @DataMember(Name="store")
    # @return [TrueClass]
    attr_accessor :store

    # @DataMember(Name="logprobs")
    # @return [TrueClass]
    attr_accessor :logprobs

    # @DataMember(Name="parallel_tool_calls")
    # @return [TrueClass]
    attr_accessor :parallel_tool_calls

    # @DataMember(Name="enable_thinking")
    # @return [TrueClass]
    attr_accessor :enable_thinking

    # @DataMember(Name="stream")
    # @return [TrueClass]
    attr_accessor :stream
end
